<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<select id="city2" name="city" <!-- lay-verify="required" --> >
		  <option value="">请选择一个城市</option>
		  <option value="010">北京</option>
		  <option value="021">上海</option>
		  <option value="0571" disabled>杭州</option>
		</select>
		<button type="button" id="sub">获取</button>
	</body>
	<script type="text/javascript">
		
		document.getElementById("sub").onclick=
		function (){
			var city=document.getElementById("city2");
			var selectOpt=city.options;
			var index=selectOpt.selectedIndex;
			// console.log(index);
			 console.log(selectOpt[index].value);
			 console.log(selectOpt[index].text);
		}
	</script>
</html>
